<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">
    <ui:define name="head">
        <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                    else
                        event.srcElement.click();
                }
            }
        </script>
        <style type="text/css">
            .c_c {
                background: gray;
            }
        </style>
    </ui:define>
    <ui:define name="content">
        <div style="margin:5px;">
            <h:form id="form">
                <p:growl id="msgs" showDetail="false"/>
                <p:panel id="inputItemHieRelap" header="分包合同工程材料录入" style="width: 100%">
                    <h:panelGrid columns="2" style="width: 100%">
                        <h:panelGrid id="pgItemHieRelapInput" widgetVar="wvItemHieRelap"
                                     columns="8" style="width: 100%" >

                            <h:outputLabel for="noItemHieRelap" value="编号:" />
                            <h:inputText id="noItemHieRelap"
                                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_StrNo}"
                                         style="font-weight:bold;background-color:gainsboro"
                                         disabled="true">
                            </h:inputText>

                            <h:outputLabel for="name" value="名称:" />
                            <h:inputText id="name" value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_Name}"
                                         style="font-weight:bold;background-color:gainsboro"
                                         disabled="true"/>

                            <h:outputLabel for="note" value="备注内容:" />
                            <h:inputTextarea id="note" value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_Note}"
                                             rows="1" autoResize="false"
                                             style="font-weight:bold;background-color:gainsboro"
                                             disabled="true"/>

                            <h:outputLabel for="unitItemInfo" value="单位:"/>
                            <h:inputText id="unitItemInfo"
                                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_Unit}"
                                         style="font-weight:bold;background-color:gainsboro"
                                         disabled="true"/>

                            <h:outputLabel for="contractQuantityItemInfo" value="工程量:"/>
                            <h:inputText id="contractQuantityItemInfo"
                                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_ContractQuantity}"
                                         style="font-weight:bold;background-color:gainsboro;text-align:right;float:left;"
                                         disabled="true">
                                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            </h:inputText>

                            <h:outputLabel for="engMMng_BeginToCurrentPeriodMQty" value="材料累计供应数量:"/>
                            <h:inputText id="engMMng_BeginToCurrentPeriodMQty"
                                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.engMMng_BeginToCurrentPeriodMQty}"
                                         style="font-weight:bold;background-color:gainsboro;text-align:right;float:left;"
                                         disabled="true">
                                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            </h:inputText>

                            <h:outputLabel for="engMMng_CurrentPeriodMQty" value="当期材料供应数量:"/>
                            <h:inputText id="engMMng_CurrentPeriodMQty"
                                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.engMMng_CurrentPeriodMQty}"
                                         style="font-weight:bold;background-color:gainsboro;text-align:right;float:left;"
                                         disabled="true">
                                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            </h:inputText>

                            <h:outputLabel for="signPartAPriceItemInfo" value="分包材料单价:"/>
                            <h:inputText id="signPartAPriceItemInfo"
                                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_SignPartAPrice}"
                                         style="font-weight:bold;background-color:gainsboro;text-align:right;float:left;"
                                         disabled="true">
                                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            </h:inputText>

                            <h:outputLabel for="engMMngMPurchaseUnitPrice" value="材料采购单价:"/>
                            <h:inputText id="engMMngMPurchaseUnitPrice"
                                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.engMMng_MPurchaseUnitPrice}"
                                         style="font-weight:bold;background-color:gainsboro;text-align:right;float:left;"
                                         disabled="true">
                                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                             </h:inputText>

                        </h:panelGrid>
                        <h:panelGrid id="pgInputBlur" columns="8" rendered="false">
                            <h:outputLabel for="pkidItemHieRelap" value="Pkid:" />
                            <h:inputTextarea id="pkidItemHieRelap"
                                             value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_Pkid}"
                                             style="font-weight:bold;width:200px"
                                             disabled="true"/>
                            <h:outputLabel for="parentPkidItemHieRelap" value="父层Pkid:" />
                            <h:inputTextarea id="parentPkidItemHieRelap"
                                             value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_ParentPkid}"
                                             style="font-weight:bold;width:200px"
                                             disabled="true"/>
                            <h:outputLabel for="itemPkidItemHieRelap" value="项Pkid:" />
                            <h:inputTextarea id="itemPkidItemHieRelap"
                                             value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_ItemPkid}"
                                             style="font-weight:bold;width:200px"
                                             disabled="true"/>
                            <h:outputLabel for="correspondingPkidItemHieRelap" value="对应Pkid:" />
                            <h:inputTextarea id="correspondingPkidItemHieRelap"
                                             value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_CorrespondingPkid}"
                                             style="font-weight:bold;width:200px"
                                             disabled="true"/>
                            <h:outputLabel for="gradeItemHieRelap" value="层号:" />
                            <h:inputText id="gradeItemHieRelap"
                                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_Grade}"
                                         style="font-weight:bold"
                                         disabled="true"/>
                            <h:outputLabel for="orderidItemHieRelap" value="序号:" />
                            <h:inputText id="orderidItemHieRelap"
                                         value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMng.subctt_Orderid}"
                                         style="font-weight:bold"
                                         disabled="true"/>
                        </h:panelGrid>
                    </h:panelGrid>
                </p:panel>
                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="/images/ajaxloading.gif"/>
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value=""/>
                    </f:facet>
                </p:ajaxStatus>
                <p:dataTable id="ptt" style="width:100%;"
                             value="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMngList}"
                             var="record"
                             rowKey="#{record.subctt_Pkid}"
                             selection="#{itemHieRelapStlEngMAction.itemStlSubcttEngMMngSelected}"
                             selectionMode="single"
                             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink}
                                                            {LastPageLink} {RowsPerPageDropdown}"
                             paginator="true"
                             paginatorPosition="bottom"
                             rows="20"
                             rowsPerPageTemplate="200,100,50,40,30,20,10"
                             rowIndexVar="row"
                             emptyMessage="数据记录为空..."
                             widgetVar="dtItemDetail"
                             rowStyleClass="#{record.subctt_SignPartAPrice eq 0? 'c_c':record.subctt_SignPartAPrice eq null? 'c_c':null}"
                             scrollable="true"
                             scrollHeight="560">
                    <p:ajax event="rowSelect" listener="#{itemHieRelapStlEngMAction.onRowSelect}" update=":form:inputItemHieRelap"/>

                    <!--<f:facet name="header">
                        <span style="margin-left: -90%;">
                            <p:commandButton id="downloadLink" value="列的显示控制" style="width:110px"
                                             onclick ="wvColumnList.show()"
                                             rendered="true">
                            </p:commandButton>
                        </span>
                    </f:facet>-->

                    <p:column headerText="序号"
                              style="width:30px"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('rowIndex').rendered_flag}">
                        <h:outputText value="#{row + 1}"/>
                    </p:column>

                    <p:column style="width:100px" headerText="编号"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('subctt_StrNo').rendered_flag}">
                        <h:outputText value="#{record.subctt_StrNo}" escape="false"/>
                    </p:column>

                    <p:column style="width:15px" headerText="层级"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('subctt_Grade').rendered_flag}">
                        <h:outputText value="#{record.subctt_Grade}" escape="false"/>
                        <!--<h:outputText value="&#8195;&#8195;ttt#{record.grade}"/>-->
                    </p:column>

                    <p:column style="width:30px" headerText="序号"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('subctt_Orderid').rendered_flag}">
                        <h:outputText value="#{record.subctt_Orderid}" escape="false"/>
                    </p:column>

                    <p:column style="width:200px" headerText="名称"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('subctt_Name').rendered_flag}">
                        <h:outputText value="#{record.subctt_Name}" />
                    </p:column>

                    <p:column style="width:30px" headerText="单位"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('subctt_Unit').rendered_flag}">
                        <h:outputText value="#{record.subctt_Unit}" style="text-align:right"/>
                    </p:column>

                    <p:column style="width:80px" headerText="合同单价"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('subctt_ContractUnitPrice').rendered_flag}">
                        <h:outputText value="#{record.subctt_ContractUnitPrice}" style="float: right" >
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column style="width:80px" headerText="合同数量"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('subctt_ContractQuantity').rendered_flag}">
                        <h:outputText value="#{record.subctt_ContractQuantity}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column style="width:80px" headerText="合同金额"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('subctt_ContractAmount').rendered_flag}">
                        <h:outputText value="#{record.subctt_ContractAmount}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column style="width:80px" headerText="分包材料单价"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('subctt_SignPartAPrice').rendered_flag}">
                        <h:outputText value="#{record.subctt_SignPartAPrice}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column headerText="备注内容"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('subctt_Note').rendered_flag}">
                        <h:outputText value="#{record.subctt_Note}" />
                    </p:column>

                    <p:column style="width:80px" headerText="项号"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('subctt_Pkid').rendered_flag}">
                        <h:outputText value="#{record.subctt_Pkid}" />
                    </p:column>

                    <p:column style="width:100px" headerText="Item项标志"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('subctt_ItemPkid').rendered_flag}">
                        <h:outputText value="#{record.subctt_ItemPkid}" />
                    </p:column>


                    <p:column style="width:100px" headerText="工程数量项Pkid"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_Pkid').rendered_flag}">
                        <h:outputText value="#{record.engMMng_Pkid}" />
                    </p:column>

                    <!-- <p:column headerText="期"
                               rendered="#{stlSubCttEngMMngAction .columnModelSelectedMap.get('engMMng_PeriodNo').rendered_flag}">
                         <h:outputText value="#{record.engMMng_PeriodNo}" />
                     </p:column>-->

                    <p:column headerText="分包合同PKID"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_SubcttPkid').rendered_flag}">
                        <h:outputText value="#{record.engMMng_SubcttPkid}" />
                    </p:column>

                    <p:column headerText="对应分包合同项PKID"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_ItemPkid').rendered_flag}">
                        <h:outputText value="#{record.engMMng_ItemPkid}" />
                    </p:column>

                    <p:column headerText="材料累计供应数量"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_BeginToCurrentPeriodMQty').rendered_flag}">
                        <h:outputText value="#{record.engMMng_BeginToCurrentPeriodMQty}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column headerText="当期材料供应数量"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_CurrentPeriodMQty').rendered_flag}">
                        <h:outputText value="#{record.engMMng_CurrentPeriodMQty}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column headerText="材料采购单价"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_MPurchaseUnitPrice').rendered_flag}">
                        <h:outputText value="#{record.engMMng_MPurchaseUnitPrice}" style="float: right">
                            <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                        </h:outputText>
                    </p:column>

                    <p:column headerText="状态标志"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_State').rendered_flag}">
                        <h:outputText value="#{record.engMMng_State}" />
                    </p:column>

                    <p:column headerText="数据来源的标志"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_OriginFlag').rendered_flag}">
                        <h:outputText value="#{record.engMMng_OriginFlag}" />
                    </p:column>

                    <p:column headerText="记录创建人"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_CreatedBy').rendered_flag}">
                        <h:outputText value="#{record.engMMng_CreatedBy}" />
                    </p:column>

                    <p:column headerText="记录创建时间"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_CreatedDate').rendered_flag}">
                        <h:outputText value="#{record.engMMng_CreatedDate}" />
                    </p:column>

                    <p:column headerText="记录最近修改人"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_LastUpdBy').rendered_flag}">
                        <h:outputText value="#{record.engMMng_LastUpdBy}" />
                    </p:column>

                    <p:column headerText="记录最近修改时间"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_LastUpdDate').rendered_flag}">
                        <h:outputText value="#{record.engMMng_LastUpdDate}" />
                    </p:column>

                    <p:column headerText="记录修改次数"
                              rendered="#{itemHieRelapStlEngMAction .columnModelSelectedMap.get('engMMng_ModificationNum').rendered_flag}">
                        <h:outputText value="#{record.engMMng_ModificationNum}" />
                    </p:column>

                    <!-- <p:columnGroup type="footer">
                        <p:row>
                            <p:column footerText="总计: "
                                      style="text-align:right" colspan="2" />
                            <p:column footerText="#{stlSubCttEngMMngAction.totalCurrentPeriodMQty}"
                                      style="text-align:right"
                                      colspan="#{stlSubCttEngMMngAction.totalAmountColspan}">
                            </p:column>
                        </p:row>
                     </p:columnGroup>-->
                    <p:columns value="#{itemHieRelapStlEngMAction.columnModelPeriodList}" var="column" columnIndexVar="colIndex">
                        <f:facet name="header">
                            #{column.column_name}
                        </f:facet>

                        #{column.comments}
                    </p:columns>

                </p:dataTable>
                <p:dialog id="dLColumnList" widgetVar="wvColumnList"  header="列的显示控制">
                    <p:dataTable id="pdtColumnList"
                                 value="#{itemHieRelapStlEngMAction.columnModelList}"
                                 var="recordColumn"
                                 dynamic="true"
                                 rowKey="#{recordColumn.column_name}"
                                 selection="#{itemHieRelapStlEngMAction.columnModelSelectedList}"
                                 paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                 paginator="true"
                                 paginatorPosition="bottom"
                                 rows="20"
                                 rowsPerPageTemplate="200,100,50,40,30,20,10"
                                 emptyMessage="数据记录为空...">
                        <!--value="#{esCommonAction.getColumnNameByTableName(stlSubCttEngMMngAction.strTableName)}"-->
                        <!--selectionMode="multiple"可多选，但是没有多选的CheckBox-->

                        <p:column selectionMode="multiple" />

                        <p:column headerText="列号" rendered="false">
                            <h:outputText value="#{recordColumn.column_name}"/>
                        </p:column>

                        <p:column headerText="列名" style="text-align:left">
                            <h:outputText value="#{recordColumn.comments}"/>
                        </p:column>

                        <p:column headerText="选中" style="text-align:left" rendered="false">
                            <h:outputText value="#{recordColumn.rendered_flag}"/>
                        </p:column>

                        <f:facet name="footer">
                            <p:commandButton id="multiSubmitBtn" value="提交"
                                             action="#{itemHieRelapStlEngMAction.setColumnsSubmitAction}"
                                             update=":form:ptt" oncomplete="wvColumnList.hide()"/>
                        </f:facet>
                    </p:dataTable>
                </p:dialog>
            </h:form>
        </div>
    </ui:define>
</ui:composition>